package com.woniuxy.carlife.carlifeuserweb.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.carlife.carlifecommonsweb.exception.CarlifeGlobalException;
import com.woniuxy.carlife.carlifeuserweb.entity.City;
import com.woniuxy.carlife.carlifeuserweb.mapper.CityMapper;
import com.woniuxy.carlife.carlifeuserweb.service.CityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zjq
 * @ClassName:CityServiceImpl
 * @Description:
 * @date 2021/4/6 20:02
 **/

@Service
public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements CityService {

    @Resource
    CityMapper cityMapper;

    /*
     * 功能描述〈根据省id查询市〉
     * @author:zjq
     * @param:
     * @return:
     * @Date 2021/4/12 15:20
     * @throws
     */

    @Override
    public List<City> findCityByProvinceId(Integer provinceId)  {

        QueryWrapper<City> cityQueryWrapper = new QueryWrapper<>();
        cityQueryWrapper.eq("province_id", provinceId);
        List<City> cities = cityMapper.selectList(cityQueryWrapper);
        return cities == null ? null : cities;
    }
}
